import Vue from 'vue'
import Router from 'vue-router'

const _import = require('./_import_' + process.env.NODE_ENV)

Vue.use(Router)

export const constantRouterMap = [
  { path: '/login', name: 'login', component: _import('Login') },
  {
    path: '/',
    component: _import('layout/Main'),
    redirect: 'dashboard',
    name: "Index",
    meta: { title: "main", cn: "首页" },
    children: [
      { path: 'dashboard', component: _import('Dashboard'), name: "Dashboard", meta: { cn: "数据统计", ico: "mb-shuju", id: "n1", hidden: false } },
      {
        path: 'monthly', component: _import('Monthly'), redirect: 'monthly/list', name: "Monthly", meta: { cn: "月刊管理", id: "n2", ico: "mb-book", hidden: false },
          children: [
            { path: 'list', component: _import('List'), name: "MonthList", meta: { cn: "月刊列表", id: "n2" } },
            { path: 'message/:mid', component: _import('Message'), name: "Message", meta: { cn: "留言管理", id: "n2" } },
          ]
      },
    ]
  },
  { path: '*', component: _import('error/P404') }
]

export default new Router({
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
